// 创建路由器

// 1. 引入 createRouter
import {createRouter, createWebHistory} from "vue-router";

// 引入可能用到的组件

import Home from "@/pages/Home.vue"
import News from "@/pages/News.vue";
import Detail from "@/pages/Detail.vue";
import About from "@/pages/About.vue";

// 2. 创建路由器
const router = createRouter({
    // 指定工作模式
    history: createWebHistory(),
    // 定义路由规则
    routes: [
        {
            path: '/home',
            component: Home,
        },
        {
            path: '/news',
            component: News,
            children: [
                {
                    path: 'detail',
                    component: Detail,
                }
            ]
        },
        {
            path: '/about',
            component: About,
        },
    ],
});

export default router